using micromsg;
using MicroMsg.Common.Event;
using MicroMsg.Common.Utils;
using MicroMsg.Protocol;
using System;
namespace MicroMsg.Scene
{
	public class NetSceneResetPwd : NetSceneBaseEx<ResetPwdRequest, ResetPwdResponse, ResetPwdRequest.Builder>
	{
		private const string TAG = "NetSceneResetPwd";
		public void doScene(string mobile)
		{
			base.beginBuilder();
			this.mBuilder.BaseRequest = NetSceneBase.makeBaseRequest(0);
			this.mBuilder.OpCode = 0u;
			this.mBuilder.Pwd = mobile;
			this.mSessionPack.mConnectMode = 2;
			this.mSessionPack.mCmdUri = "/cgi-bin/micromsg-bin/getresetpwdurl";
			base.endBuilder();
		}
		protected override void onSuccess(ResetPwdRequest request, ResetPwdResponse response)
		{
			RetConst ret = (RetConst)response.BaseResponse.Ret;
			if (ret == RetConst.MM_OK)
			{
				Log.smethod_5("NetSceneResetPwd", "NetSceneResetPwd: success. phone = " + request.Pwd);
				EventCenter.postEvent(EventConst.ON_NETSCENE_RESETPWD_SUCCESS, ret, null);
				return;
			}
			Log.smethod_5("NetSceneResetPwd", "Failed,   ret = " + ret);
			EventCenter.postEvent(EventConst.ON_NETSCENE_RESETPWD_ERR, ret, null);
		}
		protected override void onFailed(ResetPwdRequest request, ResetPwdResponse response)
		{
			EventCenter.postEvent(EventConst.ON_NETSCENE_RESETPWD_ERR, -800000, null);
		}
		private static void onMobileResetPwdHandler(EventWatcher watcher, BaseEventArgs evtArgs)
		{
			if (evtArgs.mEventID == EventConst.ON_NETSCENE_RESETPWD_SUCCESS)
			{
				Log.smethod_5("QQREG", "(1/1)onMobileResetPwdHandler");
			}
		}
		public static void testResetPwdWithMobile()
		{
			EventWatcher eventWatcher = new EventWatcher(null, null, new EventHandlerDelegate(NetSceneResetPwd.onMobileResetPwdHandler));
			EventCenter.registerEventWatcher(EventConst.ON_NETSCENE_RESETPWD_SUCCESS, eventWatcher);
			ServiceCenter.sceneResetPwd.doScene("18923885064");
		}
	}
}
